package pers.fulsun.es.test._02_index;

import java.io.IOException;
import org.elasticsearch.client.RequestOptions;
import org.elasticsearch.client.RestHighLevelClient;
import org.elasticsearch.client.indices.GetIndexRequest;
import org.elasticsearch.client.indices.GetIndexResponse;
import pers.fulsun.es.test._01_ESClient;

public class _02_ESTest_Index_Search {
  private static RestHighLevelClient client = _01_ESClient.getClient();

  public static void main(String[] args) throws IOException {
    // 查询索引 - 请求对象
    GetIndexRequest request = new GetIndexRequest("user");
    // 发送请求，获取响应
    GetIndexResponse getIndexResponse = client.indices().get(request, RequestOptions.DEFAULT);
    // 响应状态
    System.out.println(getIndexResponse.getAliases());
    System.out.println(getIndexResponse.getMappings());
    System.out.println(getIndexResponse.getSettings());
    // 关闭客户端连接
    client.close();
  }
}
